<form class="layui-form" action="{:url()}" method="post" id="editForm">
    <div class="layui-inline">
        <label class="layui-form-label">工厂</label>
        <div class="layui-input-inline" id="factory_all" style="width: auto;min-width: 250px;">
        </div>
    </div>
    {:FormExt::input('SKU', 'sku', '', '', 'required', 'lay-verify="required"')}
    {:FormExt::select('分类', 'type', '',$type,'','','lay-verify="required"')}
    {:FormExt::select('来源', 'is_auto_import', '',config('mimo.order_from'),'','','lay-verify="required"')}
    {:FormExt::input('日均销量（件）', 'average_daily_sales_num', '0', '', 'required', 'lay-verify="required|number"')}
    {:FormExt::input('可售/断码的天数', 'day', '0', '', 'required', 'lay-verify="required|number"')}
    {:FormExt::checkbox('码信息','size', explode(',', $formData['size']), $break_code_size,'','lay-verify=""')}
    <div class="layui-inline removeStat">
        <label class="layui-form-label">确定时间</label>
        <div class="layui-input-inline">
            <input type="text" name="confirm_time" value="{$today}" readonly="" id="create_date_range" lay-verify="required" placeholder="选择日期" class="layui-input required">
        </div>
    </div>
    <div class="pop-bottom-bar">
    	<input type="hidden" class="field-id" name="id">
        <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formSubmit" hisi-data="{pop: true, refresh: true}">提交保存</button>
        <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
    </div>
</form>

{include file="system@block/layui" /}
<script src="__PUBLIC_JS__/jquery.2.1.4.min.js?v={:config('hisiphp.version')}"></script>
<script src="__PUBLIC_JS__/xm-select/dist/xm-select.js?v={:config('hisiphp.version')}"></script>
<script src="__PUBLIC_JS__/vue@3.2.26/dist/vue.global.js"></script>
<script>
    var formData = {:json_encode($formData)};
    var factoryAll= JSON.parse('{:json_encode($factoryAll)}');
    layui.use(['form', 'func','laydate'], function() {
        var $ = layui.jquery, form = layui.form;
        var laydate = layui.laydate;
        // form.render();
        layui.func.assign(formData);
        laydate.render({
            elem: '#create_date_range'
            // ,range: '~'
            ,type:'datetime'
            ,theme: 'molv'
            ,mark: {'{:$today}':''}
            ,change: function(value, date, endDate){
                $('#create_date_range').val(value);
                $('#layui-laydate1').remove();//关闭面板
            }
        });
    });

    var factory_all = xmSelect.render({
        el: '#factory_all',
        name:'factory_all',
        autoRow: true,
        filterable: true,
        radio: true,
        tree: {
            show: true,
            showFolderIcon: true,
            showLine: true,
            indent: 20,
            expandedKeys: [ -3 ],
        },
        toolbar: {
            show: true,
            list: ['ALL', 'REVERSE', 'CLEAR']
        },
        filterable: true,
        height: 'auto',
        data: function(){
            return factoryAll;
        },
        on: function(data){
            console.log(data);
            //arr:  当前多选已选中的数据
            var arr = data.arr;
            //change, 此次选择变化的数据,数组
            var change = data.change;
            //isAdd, 此次操作是新增还是删除
            var isAdd = data.isAdd;

            //可以return一个数组, 代表想选中的数据
            //return []
        }
    })
</script>